package com.gxy.learn.design.model.behaviour.observer.jdk;

import lombok.extern.slf4j.Slf4j;

import java.util.Observable;

/**
 * @description: 被观察者角色
 * @author: gaoxueyong
 * @Date: 2022/11/8 19:56
 */
@Slf4j
public class Thief extends Observable{
    private String name;

    public Thief(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void steal(){
        log.info("{}（小偷）：我偷东西了，有没有人来抓我！！！",name);
        super.setChanged();
        super.notifyObservers();
    }
}
